<template>
	<view class="wrap">
		<view class="top">
			<view class="showUser" v-if="loginInfo.length">
				<view class="userPic">
					<image src="../../static/heard.webp" mode="widthFix"></image>
				</view>
				<view class="userName">
					{{loginInfo}}
				</view>
				<view class="exit" @click="handleExit">
					退出登录
				</view>
				
			</view>
			<view class="hideUser" v-else>
				<navigator class="loginBtn" url="../login/login">
					登录
				</navigator>
			</view>
		</view>
		<view class="main">
			<navigator class="item" :url="item.url" v-for="(item,index) in setList" :key="index">
				<view class="name">{{item.name}}</view>
				<view class="moreIcon">&gt</view>
			</navigator>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				loginInfo:"",
				setList:[
					{"name":"全部订单",url:"/pages/order/order"},
					{"name":"会员中心",url:"/pages/vipPage/vipPage"},
					{"name":"权益中心",url:"/pages/vipPage/vipPage"},
					{"name":"服务中心",url:"/pages/vipPage/vipPage"},
					{"name":"设置",url:"/pages/vipPage/vipPage"}
				]
			}
		},
		onShow() {
			if(uni.getStorageSync("loginInfo")){
				this.loginInfo = uni.getStorageSync("loginInfo")
			}else{
				this.loginInfo =""
			}
		},
		methods: {
			handleExit(){
				uni.removeStorageSync("loginInfo")
				this.loginInfo = ""
			}
		}
	}
</script>

<style lang="less">
.wrap{
	.top{
		width: 100%;
		height: 400rpx;
		background-color:skyblue;
		display: flex;
		flex-direction: column;
		align-items: center;
		color: white;
		justify-content: center;
		.showUser{
			display: flex;
			flex-direction: column;
			justify-content: center;
			align-items: center;
			font-size: 28rpx;
			.userName{
				padding: 10rpx 0;
			}
			.exit{
				padding: 5rpx;
				border: 1rpx solid white;
				border-radius: 10rpx;
			}
			.userPic{
				width: 120rpx;
				height: 120rpx;
				border-radius: 50%;
				overflow: hidden;
				border: 6rpx solid rgba(255,255,255,0.5);
				image{
					width: 100%;
				}
			}
		}
		.hideUser{
			font-size: 28rpx;
			.loginBtn{
				padding: 5rpx 20rpx;
				border: 1rpx solid white;
				border-radius: 10rpx;
			}
		}
	}
	.main{
		padding: 0 30rpx;
		.item{
			width: 100%;
			height: 100rpx;
			display: flex;
			justify-content: space-between;
			align-items: center;
			border-bottom: 2rpx solid #efefef;
			.moreIcon{
				font-size: 36rpx;
				color: gray;
				font-weight: bold;
			}
		}
	}
}
</style>
